// 登录
function signin() {
    var form = new FormData();
    var username = document.getElementById("username").value;
    var pwd = document.getElementById("pwd").value;
    var remembered = document.getElementById("remembered").checked;
    // var remembered1 = document.getElementById("remembered").innerText;
    form.append("username", username);
    form.append("pwd", pwd);
    form.append("remembered", remembered);
    form.append("login_type", 'user');
    form.append("platform", 'web');

    var xhr = new XMLHttpRequest();
    var local_host = window.location.host;          // 获取当前IP
    xhr.open('post', "/personal-center/signin", true);
    xhr.send(form);
    xhr.onreadystatechange = function () {
        if (xhr.readyState === 4) {
            if (xhr.status === 200) {
                var JsonData = JSON.parse(xhr.responseText);
                if(JsonData['code'] === 200){
                    if(JsonData['username'] === 'admin'){
                        location.href = "/system-setup/SuperSU_Pro.html";
                    }else {
                    location.href = "/personal-center/home.html";}
                }
                else{
                    alert(JsonData['message'])
            }

            }

        }
    };
}
